JRE/JDE related ANT build Errors

Categories: Java; Tagged with: ; @ July 30th, 2012 18:35

I’m trying to build some java project in my new pc, got some error:

build.xml:46: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to “C:\Program Files (x86)\Java\jre7”

or :

cannot access java.util.ArrayList
    [javac] bad class file: C:\Program Files (x86)\Java\jre7\lib\rt.jar(java/util/ArrayList.class)
    [javac] class file has wrong version 51.0, should be 49.0
    [javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
    [javac] import java.util.ArrayList;
    [javac]                  ^
    [javac] 1 error
    [javac] 100 warnings

I have config the Path environment variable, and the JRE installed in Eclipse preferences, I got those Errors also, and I forget there also need to config the ant run configuration:  run as… and switch to ‘JRE’ tab, select the right JDK.

<->



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.